package com.kaishengit.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.kaishengit.entity.Folder;
import com.kaishengit.util.DBHelp;
import com.kaishengit.util.RowMapper;

public class FolderDao {
	private DBHelp<Folder> db = new DBHelp<Folder>();
	public Folder findById(int id){
		String sql="select * from t_folder where id=?;";
		return db.executeQueryForObject(sql, new FolderRowMapper(), id);
	}
	private class FolderRowMapper implements RowMapper<Folder>{

		public Folder mapperRow(ResultSet rs) throws SQLException {
			// TODO Auto-generated method stub
			Folder f = new Folder();
			f.setBuilder(rs.getString("builder"));
			f.setFileName(rs.getString("fileName"));
			f.setId(rs.getInt("id"));
			f.setSize(rs.getFloat("size"));
			f.setProjectid(rs.getInt("projectid"));
			f.setUserid(rs.getInt("userid"));
			return f;
		}
		
	}
}
